//数字添加上千位分隔符（逗号
export function addCommas(num, isComma) {
	let arr = []
	if (typeof(num) == 'string') {
		arr = num.split('.')
	} else {
		arr = num.toString().split('.')
	}

	let numF = arr[0]
	if (isComma) {
		numF = arr[0].toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
	}
	return arr.length > 1 ? [numF + '.', arr[1]] : [numF]
}


export  function returnState (e){
		if (e == 11) return {
		  background: '#2BD6D6',
		  text: 'trade'
		}
		if (e == 42) return {
		  background: '#506CFF',
		  text: 'Complete'
		}
		if (e == 41) return {
		  background: '#B1B9E1',
		  text: 'Cancel'
		}
		if (e == 12) return {
		  background: '#9CC135',
		  text: 'buyer paid'
		}
		if (e == 20) return {
		  background: '#F4BC50',
		  text: 'Negotiation'
		}
		if (e == 30) return {
		  background: '#FF63A5',
		  text: 'Dispute'
		}
}

export function checkPhone(mobile) {
	const reg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(16[0-9]{1})|(17[0-9]{1})|(19[0-9]{1}))+\d{8})$/;
	return reg.test(mobile)
}